/**
 * Copyright (C), 2019-2022, 宇信融汇
 * FileName: LimitClass
 * Author:   666
 * Date:     2022/1/17 11:57
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 666           修改时间           版本号              描述
 */
package com.collectiondemo.GenericityClassDemo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

/**
 * @Classname LimitClass
 * @Description 通配符  "？"
 * @Date 2022/1/17 11:57
 * @Created by 666
 */
public class LimitClass {
    public static void main(String[] args) {
        ArrayList<CCQC> ccqcs = new ArrayList<>();
        go(ccqcs);
        ArrayList<BYD> byd = new ArrayList<>();
        go(byd);
        ArrayList<Car> car = new ArrayList<>();
        go(car);
        goTO(car);
        ArrayList<MCar> mCar = new ArrayList<>();
        goTO(car);
        goTO(mCar);
        Collections.addAll(mCar, new BYD("car"));

        Collections.sort(mCar, new Comparator<MCar>() {
            @Override
            public int compare(MCar o1, MCar o2) {
                return 0;
            }
        });

//        ArrayList<Dog> dog = new ArrayList<>();
//        go(dog);
    }

    /*
     *@Description 通配符 cars extengds   上限 ，只能她自身和子类使用  ？extends 父类
     *@param  [cars]
     *@return void
     *@date
     *@auther
     */
    public static void go(ArrayList<? extends Car> cars) {

    }

    public static void goTO(ArrayList<? super Car> cars) {

    }

}

class MCar {
    private String mCar;

    public MCar(String mCar) {
    }

}

class Car extends MCar {
    private String car;

    public Car(String car) {
        super(car);
        this.car = car;
    }


}

class Dog {

}

class CCQC extends Car {
    private String Ccqcc;

    public CCQC(String car) {
        super(car);
    }


}

class BYD extends Car {
    private String byd;

    public BYD(String car) {
        super(car);
    }


}
